<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>评委注册</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <style>
            body {
                font-family: 'Open Sans', sans-serif;
                line-height: 30px;
                background:url('assets/img/background6.jpg')no-repeat;              
                background-size:cover;
            }
            .alp-div {
                filter:alpha(Opacity=90);
                -moz-opacity:0.5;
                opacity: 0.5;
                background-color: #000;
                color:#fff;
                text-align:left;
                padding: 20px;
                position: absolute;
                top: 100px;
                width:420px;
                height:500px;
                left:50%;
                top:50%; 
                margin-left:-210px;
                margin-top:-250px;
                border:1px solid #fff;
            }
            .button-center {
                margin-top: 10px;
                text-align:center;
            }
            .btn {
                width: 150px;
                height: 60px;
                font-size: 20px;
            }
            .btn-left{
                margin-right: 20px;
            }
            .btn-right{
                margin-left: 20px;
            }
            button:hover{
                color: #2945a5;
            }
            input{
                width: 200px;
            }
            #sex{
                width: 60px;
            }
            select{
                width: 205px;
            }
            #chairman_qualifications{
                width: 60px;
            }
        </style>
    </head>
    <body>
        <?PHP
        if (!empty($_GET['email'])) {$email = $_GET['email'];} else {$email = '';}
        $mysqli = mysqli_init();
        $mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT, 2); //设置超时时间
        $mysqli->real_connect('127.0.0.1', 'root', 'mysql');
        $sql = "CREATE DATABASE IF NOT EXISTS CUPT DEFAULT CHARSET utf8 COLLATE utf8_general_ci;";
        if ($mysqli->query($sql) == TRUE) {
        //printf("Table CUPT successfully created.\n");
        }
        mysqli_select_db($mysqli, "CUPT");
        $sql="select * from judge where `email`='$email'";
        $rst = $mysqli->query($sql);
        $name ='';
        $sex = '';
        $school='';
        $phone_number='';
        $job_title = '';
        $phone_number ='';
        $clothing_model = '';
        $bank_account='';
        $bank='';
        while ($row = mysqli_fetch_assoc($rst)) {
        $name = $row['name'];
        $sex = $row['sex'];
        $school=$row['school'];
        $job_title = $row['job_title'];
        $phone_number = $row['phone_number'];
        $clothing_model = $row['clothing_model'];
        $bank_account=$row['bank_account'];
        $bank=$row['bank'];
        }
        ?>
        <div class="alp-div">
            <form action="" name="judge_signup" method="post">
                <div class="form-group">
                    <input type="email" class="form-control" required="required" id="email" name="email" placeholder="Email" value="<?PHP echo $email; ?>"/>Email<br />
                    <input type="password" class="form-control" required="required" id="password" name="password" placeholder="密码" onkeyup="password_validate()"/>密码<span id="password_"></span><br />
                    <input type="password" class="form-control" required="required" id="repeat_password" name="repeat_password" placeholder="确认密码" onkeyup="password_validate()"/>确认密码<span id="repeat_password_"></span><br />
                    <input type="text" class="form-control" required="required" id="name"  name="name"placeholder="姓名" value="<?PHP echo $name; ?>"/>姓名<br />
                    性别<input type="radio" class="form-control" required="required" id="sex" name="sex" placeholder="性别" value="男"/>男<input type="radio" class="form-control" required="required" id="sex" name="sex" placeholder="性别" value="女"/>女<br />
                    <input type="text" class="form-control" required="required" id="school"  name="school" list="school_list" placeholder="学校" value="<?PHP echo $school; ?>"/>学校<br />
                    <datalist id="school_list" >
                        <?PHP
                        $school_arr=['哈尔滨工业大学（深圳）','华南理工大学','华中科技大学','华中师范大学','暨南大学','南方科技大学','武汉大学','湘潭大学','中南大学','中山大学'];
                        for($i=0;$i<=9;$i++){
                        echo "<option value='$school_arr[$i]'>$school_arr[$i]</option>";
                        }
                        ?>
                    </datalist>
                    <input type="text" class="form-control" required="required" id="job_title"  name="job_title" placeholder="职称" value="<?PHP echo $job_title; ?>"/>职称<br />
                    <input type="text" class="form-control" required="required" id="phone_number" name="phone_number" placeholder="手机号码" value="<?PHP echo $phone_number; ?>"/>手机号码<br />
                    <select required="required" id="clothing_model" name="clothing_model" >
                        <option value="S">S</option>
                        <option value="M">M</option>
                        <option value="L">L</option>
                        <option value="XL">XL</option>
                        <option value="XXL">XXL</option>
                        <option value="XXXL">XXXL</option>
                        <option value="XXXXL">XXXXL</option>
                    </select>衣服尺码<br />
                    <input type="text" class="form-control"  required="required" id="bank_account" name="bank_account" placeholder="银行卡号" value="<?PHP echo $bank_account; ?>"/>银行卡号<br />
                    <input type="text" class="form-control"  required="required" id="bank" name="bank" placeholder="开户银行" value="<?PHP echo $bank; ?>"/>开户银行<br />
                    是否想担任主席<input type="radio" class="form-control" required="required" id="chairman_qualifications" name="chairman_qualifications"  value="a"/>是<input type="radio" class="form-control" required="required" id="chairman_qualifications" name="chairman_qualifications" value="b"/>否<br />(每学校必须有且仅有一位评委担任主席)
                </div>
                <div class="button-center">
                    <button disabled="disabled" id="signup" type="submit" class="btn btn-left" onclick="signup_button()">提交注册信息</button>
                    <button disabled="disabled" id="modify" type="submit" class="btn btn-right" onclick="modify_button()">修改注册信息</button>
                </div>
            </form>
        </div>
        <script type='text/javascript'>
            function signup_button() {
                document.judge_signup.action = "judge-signup.php?flag=0";
                document.judge_signup.submit();
            }
            function modify_button() {
                document.judge_signup.action = "judge-signup.php?flag=1";
                document.judge_signup.submit();
            }
            function password_validate() {
                var pwd1 = document.getElementById("password").value;
                var pwd2 = document.getElementById("repeat_password").value;
                if (pwd1.length < 8) {
                    document.getElementById("password_").innerHTML = "<font color='red'>密码长度需大于8位</font>";
                    document.getElementById("signup").disabled = true;
                    document.getElementById("modify").disabled = true;
                } else {
                    document.getElementById("password_").innerHTML = "<font color='green'>密码长度符合要求</font>";
                    if (pwd1 == pwd2)
                    {
                        document.getElementById("repeat_password_").innerHTML = "<font color='green'>两次密码相同</font>";
                        document.getElementById("signup").disabled = false;
                        document.getElementById("modify").disabled = false;
                    } else {
                        document.getElementById("repeat_password_").innerHTML = "<font color='red'>两次密码不相同</font>";
                        document.getElementById("signup").disabled = true;
                        document.getElementById("modify").disabled = true;
                    }
                }
            }
        </script>





    </body>
</html>
